class Solution(object):
    def carFleet(self, target, position, speed):
        n = len(position)
        t = [[position[i], speed[i]] for i in range(n)]
        t.sort(reverse=True)
        time = (target - t[0][0]) / t[0][1]
        c = 1
        for i in range(1, n):
            if (target - t[i][0]) / t[i][1] <= time:
                continue
            else:
                c += 1
                time = (target - t[i][0]) / t[i][1]
        return c


data = Solution()
target = 12
position = [10, 8, 0, 5, 3]
speed = [2, 4, 1, 1, 3]
print(data.carFleet(target, position, speed))
